local rangqi = fk.CreateSkill {
  name = "lingling__rangqi",
}

Fk:loadTranslationTable{
  ["lingling__rangqi"] = "攘器",
  [":lingling__rangqi"] = "当你失去装备区的一张牌后，你可以摸两张牌。",
}

rangqi:addEffect(fk.AfterCardsMove, {
  anim_type = "drawcard",
  trigger_times = function(self, event, target, player, data)
    local i = 0
    for _, move in ipairs(data) do
      if move.from == player then
        for _, info in ipairs(move.moveInfo) do
          if info.fromArea == Card.PlayerEquip then
            i = i + 1
          end
        end
      end
    end
    return i
  end,
  can_trigger = function(self, event, target, player, data)
    if not player:hasSkill(rangqi.name) then return end
    for _, move in ipairs(data) do
      if move.from == player then
        for _, info in ipairs(move.moveInfo) do
          if info.fromArea == Card.PlayerEquip then
            return true
          end
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(2, rangqi.name)
  end,
})

return rangqi
